package com.newlink.building.userinfo.mvp

import com.newlink.building.common_base.base.BasePresenter
import com.newlink.building.common_base.ext.ss
import com.newlink.building.userinfo.mvp.contract.Module_UserInfo_FlsMessageCenterDetailContract
import com.newlink.building.userinfo.mvp.model.Module_UserInfo_FlsMessageCenterDetailModel

/**
 * @author wangyang
 * @date 2022/4/11
 * @description 我的——消息中心——消息详情页面的Presenter
 */
class Module_UserInfo_FlsMessageCenterDetailPresenter :
    BasePresenter<Module_UserInfo_FlsMessageCenterDetailContract.Model, Module_UserInfo_FlsMessageCenterDetailContract.View>(),
    Module_UserInfo_FlsMessageCenterDetailContract.Presenter {

    override fun createModel(): Module_UserInfo_FlsMessageCenterDetailContract.Model? {
        return Module_UserInfo_FlsMessageCenterDetailModel()
    }

    override fun setMessageReadStatus(token: String, id: Long) {
        mModel?.setMessageReadStatus(token, id)?.ss(mModel, mView) { result ->
            result?.let {
                if (it.code == 200) {
                    mView?.setMessageReadStatusSuccess()
                } else {
                    mView?.setMessageReadStatusFail()
                }
            }
        }
    }
}